Q: How much does the use of user paths improve drawing speed?
A: Here are some numbers which quantify for one particular situation the benefit of using user paths. Two interesting things from the numbers below are:
1- size of the win
2- user paths, like xyshow are a performance (if not convenience) win even when drawing just a few lines.
Table shows cumulative time(sec) taken to do 100 iterations of a loop which does an erase, draws a number of lines (vertical 150 pixels high), flushes the window and pings the window server. 4 Different cases were tested:
Case 1: Draw lines using PSlineto() and PSmoveto(). lockFocus and unLockFocus inside loop
Case 2: Same as Case 1 except lockFocus and unLockFocus taken out of loop
Case 3: Draw lines using DPSDoUserPath(), arrays malloc'd, initialized and freed inside loop. lockFocus and unlockFocus outside loop.
Case 4: Same as Case 3 except that user path is cached via ucache.
Results
# lines case1 case 2 case 3 case 4
5 3.57 2.95 2.41 2.19
10 4.46 3.85 2.64 2.37
20 6.99 6.39 3.13 2.70
40 11.34 9.99 4.09 3.36
Note: In all cases timing includes time required to do erase, flushwindow and ping window server inside loop.